<%@include file="/WEB-INF/templates/configuration.jsp" %>
<%-- 
    Document   : user_profile-body
    Created on : 16-Nov-2012, 16:53:07
    Author     : Roald
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="windows-1252"%>
<!DOCTYPE html>
<%
    HttpSession session_user = request.getSession(true);
    String firstname = (String) session_user.getAttribute("user_firstname");
    String user_username = (String) session_user.getAttribute("user_username");
    int user_id = 0;
    int user_type = 0;
    if (firstname != null) {
        user_id = Integer.valueOf("" + session_user.getAttribute("user_id"));
        user_type = Integer.valueOf("" + session_user.getAttribute("user_type"));
    }
    String headteacher = (String) request.getAttribute("Headteacher");
%>
<c:choose>
    <c:when test="${empty document}">
        <form action="new" method="post" enctype="multipart/form-data">
            <!-- Als er geen id is meegegeven, ga je een cursus toevoegen -->
            <input type="hidden" name="uploadassignmentid" id="uploadassignmentid" value="${assignment.uploadassignmentid}"></input>
        </c:when>
        <c:otherwise>
            <form action="view" method="post" enctype="multipart/form-data">
                <input type="hidden" name="documentid" id="documentid" value="${document.uploadedassignmentid}"></input>
                <!-- Anders ga je een gebruiker wijzigen -->
            </c:otherwise>
        </c:choose>
        <input type="hidden" name="documentid" id="documentid" value="${document.uploadassignment.uploadassignmentid}"></input>
        <h2 class="course-header left" style="">Upload your Assignment</h2><a href="${url}chapter/edit?chapterid=${chapter.chapterid}" class="edit icon"></a>
        <br class="clearfix">
        <hr>
        <div class="">
            <p><b>Assignment name:</b> ${assignment.uploadassignmentname}</p>
            <p><b>Assignment Description:</b> </p>
            <p>${assignment.uploadassignmentdescription}</p>
        </div>

        <hr/>
        <div class="assignment-content">

            <c:choose>
                <c:when test="${not empty document}">
                    <a href="${document.documentpath}">Download File<img src="${imgurl}download-icon.png" height="25" width="25"></img></a>
                    <br/><br/>
                    <table>
                        <tr><td><b for="description">File Description</b></td></tr>
                        <tr><td><p>${document.uploadedassignmentdescription}</p></td></tr>
                    </table>
                </c:when>
                <c:otherwise>
                    <table>
                        <tr><td><input type="file" name="file" /></td></tr>
                        <tr><td><label for="description">File Description</label></td></tr>
                        <tr><td><textarea rows="3" cols="50" id="filedescription" class="mceEditor" name="description">${document.uploadedassignmentdescription}</textarea></td></tr>
                    </table>
                </c:otherwise>
            </c:choose>






        </div>
        <c:choose>
            <c:when test="${not empty document}">
            </c:when>
            <c:otherwise>
                <input type="submit" class="button" value="Upload Assignment" /><a class="button" href="javascript:javascript:history.go(-1)">Back to Assignment overview</a>
            </c:otherwise>
        </c:choose>

    </form>
    <c:choose>
        <c:when test="${not empty document}">
            <form action="approve" method="post">
                <input type="hidden" name="documentid" id="documentid" value="${document.uploadedassignmentid}"></input>
                <%if (user_type == 3 || user_type == 2) {%>
                <input type="hidden" name="admin" id="admin" value="1"></input>
                <% } else {%>
                <input type="hidden" name="admin" id="admin" value="0"></input>
                <% } %>
                <input type="submit" class="button" value="Approve Assignment" />
            </form>
        </c:when>
        <c:otherwise>
        </c:otherwise>
    </c:choose>

